// ExamClient.h : main header file for the PROJECT_NAME application
//

#pragma once

#ifndef __AFXWIN_H__
    #error "include 'stdafx.h' before including this file for PCH"
#endif

#include "resource.h"        // main symbols


// CExamClientApp:
// See ExamClient.cpp for the implementation of this class
//

class CExamClientApp : public CWinApp
{
public:
    CExamClientApp();

// Overrides
    public:
    virtual BOOL InitInstance();

// Implementation

    DECLARE_MESSAGE_MAP()

protected:
    bool SetUpAndInitialize(void);
    bool LogIn(void);
    bool ShowQuestionAndAnswer(void);
    bool ScoreAndUploadAnswer(void);
    bool Finalize(void);
};

extern CExamClientApp theApp;


#ifdef _UNICODE
#define StringSymble _T("%s")
#else
#define StringSymble _T("%S")
#endif

#include "Poco\UnicodeConverter.h"
#include <string>
#include <atlconv.h>

inline CString &Utf8String2CString(CString &cstr, const std::string &ustr)
{
    std::wstring wstr;
    Poco::UnicodeConverter::toUTF16(ustr, wstr);
    cstr.Format(StringSymble, wstr.c_str());
    return cstr;
}

inline std::string &CString2Utf8String(std::string &ustr, CString &cstr)
{
    USES_CONVERSION;
    Poco::UnicodeConverter::toUTF8(T2W(cstr.GetBuffer()), ustr);
    return ustr;
}


#include "Poco\AutoPtr.h"
#include "Poco\Util\XMLConfiguration.h"

extern Poco::AutoPtr<Poco::Util::XMLConfiguration> configuration;